import request from './request.js';

// 获取文章分类信息
export async function getBlogType() {
  return await request.get('/api/blogtype');
}

// 获取文章列表信息
export async function getBlogList(current = 1, limit = 10, cateid = -1) {
  return await request.get('/api/blog', {
    params: {
      current,
      limit,
      cateid
    }
  })
}

// 获取文章内容信息
export async function getBlogDetail(id) {
  return await request.get(`/api/blog/${id}`)
}

// 获取评论数据
export async function getComment(blogId, page = 1, limit = 10) {
  return await request.get(`/api/comment`, {
    params: {
      limit,
      blogId,
      page
    }
  })
}

// 提交评论信息
export async function pushComment(info) {
  return await request.post(`/api/comment`, info)
}